package com.twu.biblioteca;

/**
 * Created with IntelliJ IDEA.
 * User: ysotirov
 * Date: 03/02/13
 * Time: 17:49
 * To change this template use File | Settings | File Templates.
 */
public class Movie {
    String title;
    String year;
    String director;
    int rating;

    public Movie (String titl, int yr, String dir) {
        title = titl;
        year = Integer.toString(yr);
        director = dir;
        rating = 0;
    }

    public void setRating(int rate){
        if (rate >0 && rate<=10)
        rating = rate;
        else rating=0;
    }

    public String getMovieForPrint()
    {
        String rate;
        if (rating == 0) rate = "N/A";
        else rate = Integer.toString(rating);
        return (title+"\t"+year+"\t"+director+"\t"+rate);
    }
}
